package com.wskj.framework.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
* Filename: RedisListenerConfig.java
* Description: 配置redis监听
* Copyright: Copyright (c) 2016-2019 All Rights Reserved. 
* Company: wsdz.com Inc. 
*
* @author: gunk
* @version: 1.0 
* Create at: 2022/8/22 17:23 
*
* Modification History: 
* Date Author Version Description 
* ------------------------------------------------------------------ 
* 2022/8/22 guqk 1.0 1.0 Version 
*/
@Configuration
public class RedisListenerConfig {
    @Bean
    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
        // Redis消息监听器
        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
        // 监听所有库的key过期事件
        container.setConnectionFactory(connectionFactory);
        return container;
    }
}
